CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

SET(PROJECTNAME polhemus)

PROJECT(${PROJECTNAME})

FIND_PACKAGE(YARP REQUIRED)

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${YARP_MODULE_PATH})

INCLUDE_DIRECTORIES(${YARP_INCLUDE_DIRS})

if(UNIX)
  # Temporarily use Ciaraldi's working directry
#  INCLUDE_DIRECTORIES("/home/ciaraldi/polhemus-tracker-terminal-1.0.0/src")
endif(UNIX)

if(WIN32)
  INCLUDE_DIRECTORIES("C:\\Program Files\\Polhemus\\PDI_90\\Inc")
  LINK_DIRECTORIES("C:\\Program Files\\Polhemus\\PDI_90\\Lib\\Win32")
	# removes warning for strncpy
	ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
endif(WIN32)
					
# Create everything needed to build our executable.
if(WIN32)
ADD_EXECUTABLE(polhemus src/main.cpp
	src/TrackerDevice.cpp src/TrackerDevice.h src/Tracker.h
	src/PolhemusTracker.cpp src/PolhemusTracker.h
	src/PolhemusFrame.cpp src/PolhemusFrame.h
	src/TrackerBuffer.cpp src/TrackerBuffer.h
	src/ConstantTracker.cpp src/ConstantTracker.h
	src/CircleTracker.cpp src/CircleTracker.h) 
endif(WIN32)

if(UNIX)
ADD_EXECUTABLE(polhemus main.cpp
	TrackerDevice.cpp TrackerDevice.h Tracker.h
	TrackerBuffer.cpp TrackerBuffer.h
	PiTracker.cpp PiTracker.h
	LinuxPolhemusTracker.cpp LinuxPolhemusTracker.h
	ConstantTracker.cpp ConstantTracker.h
	CircleTracker.cpp CircleTracker.h)

ADD_EXECUTABLE(PiPeek PiPeek.cpp PiPeek.h 
  PiTracker.cpp PiTracker.h
  PingPong.cpp PingPong.h)
 
endif(UNIX)

TARGET_LINK_LIBRARIES(polhemus ${YARP_LIBRARIES})

if(WIN32)
TARGET_LINK_LIBRARIES(polhemus PDID.lib) # debug version XXXXX
endif(WIN32)

if(UNIX)
TARGET_LINK_LIBRARIES(polhemus usb-1.0)
TARGET_LINK_LIBRARIES(PiPeek usb-1.0)
endif(UNIX)
